package com.ymm.utils.email;

import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;

/**
 * 邮箱身份认证类
 *
 * @author 椰咩咩咩
 * @since 2023-01-20 13:03:40
 */
class EmailAuthentication extends Authenticator {
    private String userName;
    private String userPwd;

    public EmailAuthentication(String userName, String userPwd) {
        this.userName = userName;
        this.userPwd = userPwd;
    }

    /**
     * 邮件服务器发送邮件时候进行身份验证
     *
     * @return
     */
    @Override
    protected PasswordAuthentication getPasswordAuthentication() {
        return new PasswordAuthentication(userName, userPwd);
    }
}
